package com.lyn.utils;

import android.text.TextUtils;
import android.util.Base64;

public class Base64Util {

    public static String toBase64(byte[] data) {
        if (data == null){
            return null;
        }
        return Base64.encodeToString(data, Base64.DEFAULT);
    }

    public static byte[] toByteArray(String base64) {
        if (TextUtils.isEmpty(base64)){
            return null;
        }
        return Base64.decode(base64, Base64.DEFAULT);
    }
}
